package com.ylxn.chapter01;

/**
 * 应用统筹
 */

public class demo08 {
    public static void main(String[] args) {
        Thread thread1 = new Thread(() -> {
            System.out.println("洗水壶ing...");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("烧开水ing");
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }, "person-01");

        thread1.start();

        Thread thread2 = new Thread(() -> {
            System.out.println("洗茶壶ing...");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("烧茶杯ing");
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("拿茶叶ing");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            try {
                thread1.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("可以去泡茶了。。。。");
        }, "person-02");
        thread2.start();
    }
}
